<?php
namespace app\service;

use app\models\AdminUser;
use app\models\AdminRole;
use app\models\Staff;

class LoginService
{
    /**
     * 登录验证
     * @param string $name
     * @param string $password
     * @return bool
     */
    public function login($name, $password)
    {
        $model = new AdminUser();
        return $model->login($name, $password);
    }

    /**获取用户
     * @param string $key 
     * @return array
     */
    public function getUser($key)
    {
        $model = new AdminUser();
        return $model->getUser($key);
    }

    /**角色权限
     * @param int $role_id
     * @return array
     */
    public function getRoleRules($role_id)
    {
        $model = new AdminRole();
        return $model->getRules($role_id);
    }

    /**
     * 更新用户密码
     * @param int $id
     * @param string $password
     * @return bool
     */
    public function updateUser($id,$password)
    {
        $model = new AdminUser();
        return $model->updateUser($id,$password);
    }

    /**
     * 获取员工信息
     * @param int $staff_id 员工id
     * @return array
     */
    public function getStaffInfo($staff_id)
    {
        $model = new Staff();
        return $model->getJobNumber($staff_id);
    }
}
